$(function(){
    $("#btn").click(function(){
        var old = $("#old").val()
        var now = $("#now").val()
        var con = $("#con").val();

        if(old == ''){
            alert("请输入原密码")
            return;
        }
        if(now == ''){
            alert("请输入新密码")
            return;
        }
        if(con == ''){
            alert("请再次输入新密码")
            return
        }
        if (now != con){
            alert("两次密码不一致")
            return;
        }

        $.ajax({
            url:server_url +"/rest/staff/changePass.do",
            data:{id:userid,old:old,now:now},
            success:function(data){
                if(data.retCode != '0000'){
                    alert(data.retMsg)
                    return
                }
                alert("修改成功");
                window.location.href = '/LianniuWeb/staff/personal.do'
            },
            error:function(){
                alert("网络出了点问题，请稍后重试");
            }
        })
    })
})